﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InnovTech.DynamicData.Handler
{
    public abstract class DataHandlerBase : IDynamicDataHandler
    {

        protected abstract void HandleObject(IDynamicObject obj);


        protected virtual bool IsEntity(IDynamicObject obj)
        {
            return true;
        }
        protected virtual void HandleValueObject(IDynamicObject obj) { }


        public void Handle(IDynamicData target)
        {
            foreach (var obj in target.Objects)
            {
                if (obj.ObjectType == null || !IsEntity(obj))
                    HandleValueObject(obj);
                //else
                //    SaveObject(obj);
                
            }
        }

    }
}
